﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WooCoo.Authorization
{
    public interface IAuthorizationProvider
    {
        /// <summary>
        /// 取得该用户的数据权限数据.
        /// </summary>
        /// <param name="roleID"></param>
        /// <param name="objectName"></param>
        /// <returns></returns>
        List<ResourceRight> GetObjectRight(string userID, string objectName);

        /// <summary>
        /// 空的权限对象,如果无控制的对象.也需要提供空权限信息
        /// </summary>
        /// <param name="roleID"></param>
        /// <param name="objectName"></param>
        /// <returns></returns>
        ResourceRight EmptyObjectRight(string roleID, string objectName);
        /// <summary>
        /// 从权限集合中取得指定角色对象的列表.
        /// </summary>
        /// <param name="roleID"></param>
        /// <param name="objectName"></param>
        /// <returns></returns>
        List<ResourceRight> GetList(string roleID, string objectName, List<ResourceRight> source);
        /// <summary>
        /// 两对象是否相等.
        /// </summary>
        /// <param name="or1"></param>
        /// <param name="or2"></param>
        /// <returns></returns>
        bool Compare(ResourceRight or1, ResourceRight or2);
        /// <summary>
        /// 权限对象集合并为单一的权限对象,以供调用.
        /// </summary>
        /// <param name="roleID"></param>
        /// <param name="objectName"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        ResourceRight FindObjectRight(string roleID, string objectName, AuthorizationActions action, List<ResourceRight> source);
        /// <summary>
        /// 用户验证
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        bool Validate(string userName, string password);
    }
}
